package cn.tedu.egmvc1.controller;

import cn.tedu.egmvc1.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
    @ResponseBody
    @RequestMapping("/v1/users/insert")
    public String addUser(User user){
        user.setUsername("田所浩二");
        user.setPassword("114514");
        user.setNickname("野兽先辈");
        return "添加用户成功";
    }
    @ResponseBody
    @RequestMapping("/v1/users/userList")
    public String selectUser(){

        return "查询用户列表成功";
    }

    @ResponseBody
    @RequestMapping("/v1/users/delete")
    public String deleteUser(int id){
        return "删除成功,用户id为:"+id;
    }
    @ResponseBody
    @RequestMapping("/v1/users/update")
    public String updateUser(User user){
        user.setUsername("博丽灵梦");
        user.setPassword("123456");
        user.setNickname("灵梦");
        return "更新成功";
    }
}
